<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 7.5rem;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
    function runRem(designWidth){ 
        //计算屏幕宽度
        var screen = document.body.scrollWidth;
        var htmlPx;
        htmlPx = (screen / (designWidth / 100))+'px';
        var remstyle = document.createElement('style')
        remstyle.innerHTML = "html{font-size:"+htmlPx+"}"
        document.documentElement.firstElementChild.appendChild(remstyle)
    }
    runRem(750)
    document.write('<span>111</span>');
    window.addEventListener("resize", function() {
       console.log(11)
    }, false);
    </script>
</body>
</html>